﻿/* 9. Write an expression that checks for given point (x, y) 
 * if it is within the circle K( (1,1), 3) and out of the rectangle R(top=1, left=-1, width=6, height=2). */

using System;

public class WithinCircleAndOutOfRectangle
{
    public static void Main()
    {
        double Ox, Oy, R;
        double top, left, width, height;
        double x, y;
        bool withinCircle = false;
        bool outOfRectangle = false;

        Ox = 1;
        Oy = 1;
        R = 3;
        top = 1;
        left = -1;
        width = 6;
        height = 2;

        Console.Write("x = ");
        x = double.Parse(Console.ReadLine());
        Console.Write("y = ");
        y = double.Parse(Console.ReadLine());

        withinCircle = ((x - Ox) * (x - Ox) + (y - Oy) * (y - Oy) < R * R);
        outOfRectangle = ((y < top - height) || (y > top) || (x < left) || (x > left + width));
        if (withinCircle && outOfRectangle)
            Console.WriteLine("The point is within circle and out of rectangle.");
        else
            Console.WriteLine("The point is on the edge or out of circle, or on the edge of or within rectangle.");
    }
}